package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbContentCategoryMapper;
import com.dongdongshop.pojo.TbContentCategory;
import com.dongdongshop.service.ContentCategoryService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@DubboService
public class ContentCategoryServiceImpl implements ContentCategoryService {

    @Resource
    private TbContentCategoryMapper categoryMapper;

    @Override
    public List<TbContentCategory> findAll() {
        return categoryMapper.selectByExample(null);
    }

    @Override
    public int contentCategoryAdd(TbContentCategory category) {
        return categoryMapper.insertSelective(category);
    }

    @Override
    public TbContentCategory getCategoryById(Long id) {
        return categoryMapper.selectByPrimaryKey(id);
    }

    @Override
    public int contentCategoryUpdate(TbContentCategory category) {
        return categoryMapper.updateByPrimaryKeySelective(category);
    }

    @Override
    public int deleteId(Long id) {
        return categoryMapper.deleteByPrimaryKey(id);
    }
}
